<?php

/**
 * AbetPlanStudy form base class.
 *
 * @method AbetPlanStudy getObject() Returns the current form's model object
 *
 * @package    sfproject
 * @subpackage form
 * @author     Your name here
 */
abstract class BaseAbetPlanStudyForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'code'               => new sfWidgetFormInputText(),
      'plan_Year'          => new sfWidgetFormInputText(),
      'plan_Gender'        => new sfWidgetFormInputText(),
      'name'               => new sfWidgetFormInputText(),
      'hours'              => new sfWidgetFormInputText(),
      'level'              => new sfWidgetFormInputText(),
      'theory_Hours'       => new sfWidgetFormInputText(),
      'practical_Hours'    => new sfWidgetFormInputText(),
      'abet_department_id' => new sfWidgetFormPropelChoice(array('model' => 'AbetDepartment', 'add_empty' => true)),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->getId()), 'empty_value' => $this->getObject()->getId(), 'required' => false)),
      'code'               => new sfValidatorString(array('max_length' => 10)),
      'plan_Year'          => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647)),
      'plan_Gender'        => new sfValidatorString(array('max_length' => 2)),
      'name'               => new sfValidatorString(array('max_length' => 50)),
      'hours'              => new sfValidatorString(array('max_length' => 2)),
      'level'              => new sfValidatorString(array('max_length' => 2)),
      'theory_Hours'       => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'practical_Hours'    => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'abet_department_id' => new sfValidatorPropelChoice(array('model' => 'AbetDepartment', 'column' => 'id', 'required' => false)),
      'created_at'         => new sfValidatorDateTime(array('required' => false)),
      'updated_at'         => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorAnd(array(
        new sfValidatorPropelUnique(array('model' => 'AbetPlanStudy', 'column' => array('code'))),
        new sfValidatorPropelUnique(array('model' => 'AbetPlanStudy', 'column' => array('name'))),
      ))
    );

    $this->widgetSchema->setNameFormat('abet_plan_study[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'AbetPlanStudy';
  }


}
